// .txt

beginzonescript;

variables;

short crime_tolerance = 200;
short last_abil;
short i;
short ter_adj = 0;

body;

beginstate INIT_STATE;

	add_range_to_group(23,26,1);
	set_name(1001,"Patchwork Gazer");
	set_boss_level(1001,1);
	
	add_range_to_group(27,32,2);
	add_range_to_group(33,38,3);
	add_range_to_group(39,43,4);
	add_range_to_group(44,48,5);
	add_range_to_group(49,54,6);
	
	//if (get_sdf() > 0) {
		//make_zone_hostile();
		//}

	sf(26,7,0);
	
	if (gf(26,6) == 0) {
		if (char_ok(55) == FALSE) 	
			spawn_creature(47);
			
			
		}
	
	// one free se door unlock
	if (gf(26,21) == 0) {
		sf(26,21,1);
		sf(26,18,1);
		sf(26,19,1);
		sf(26,20,1);
		}
		
	last_abil = get_current_tick();
	
	set_crime_tolerance(crime_tolerance);
	break;

beginstate EXIT_STATE;

break;

beginstate START_STATE;
	if ((ter_adj == 0) && (gf(26,10) > 0))  {
		ter_adj = 1;
		set_terrain(57,24,174);
		set_terrain(58,24,174);
		set_terrain(59,24,174);
		}
		
	// clear zone?
	if ((zone_clear(ME) == FALSE) && (get_flag(26,23) > 0) && (gf(26,6) > 0)) {
		print_str_color("You have cleared the mine's defenses.",2);
		clear_zone(ME);	
		}
		
	//if ((get_crime_level() >= crime_tolerance) && (get_sdf(,) == 0)) {
	//	make_zone_hostile();
	//	set_flag(,,1);
	//	}

	// if (gf(,) == 0) {
	//	if (get_ran(1,0,100) < 10)
	//		give_char_text_bubble(,"");
	//	}
	
	//if (((is_combat()) && (tick_difference(last_abil,get_current_tick()) > 0)) || ((is_group()) && (tick_difference(last_abil,get_current_tick()) > 5))) {
	//	last_abil = get_current_tick();
	//	}
break;

beginstate 10;
	if (gf(100,9) == 0) {
		sf(100,9,1);
		print_str_color("You have found the western entrance of the Shadow Road.",2);
		award_party_xp(100,12);
		}
break;

beginstate 11;
	sf(26,23,1);
break;

//	print_str("");
//	set_terrain_string_range(".",3);
//	set_terrain_string_range("The sign says - .",3);
